<%@ page import="com.hngc.dao.entity.User" %>
<%@ page import="com.hngc.dao.UserDao" %><%--
  Created by IntelliJ IDEA.
  User: 30969
  Date: 2024/1/10
  Time: 12:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    int id = Integer.parseInt(request.getParameter("id"));
    String name = request.getParameter("name");
    String pwd = request.getParameter("pwd");
    int age = Integer.parseInt(request.getParameter("age"));

    User user = new User(id, name, pwd, age);
    UserDao userDao = new UserDao();
    boolean result = userDao.updateUser(user);

    if (result) {
        response.sendRedirect("userlist.jsp");
    } else {
        response.sendRedirect("userUpdate.jsp");
    }
%>
</body>
</html>
